<?php

class NewsModel extends AbstractModel {

    public static function getPage($page, $newsPerPage) {/*
      --$page;
      $repository = new \SQL\Repository('News');
      $criteria = new \SQL\Criteria();
      $criteria->setProperty('order', 'post_date DESC');
      $criteria->setProperty('limit', ($page*$newsPerPage).', '.$newsPerPage);
      return $repository->load($criteria); */
    }

    public static function getQuantity() {/*
      $repository = new \SQL\Repository('News');
      $count = $repository->count();
      return $count; */
    }

    public static function getLast($num) {
      $repository = new SQLRepository('News');
      $repository->addColumn('id');
      $repository->addColumn('title');
      $criteria = new SQLCriteria();
      $criteria->setProperty('order', 'created DESC');
      $criteria->setProperty('limit', '0, '.$num);
      return $repository->load($criteria);
    }

}

?>
